//2085.统计出现过一次的公共字符串
//https://leetcode.cn/problems/count-common-words-with-one-occurrence/?envType=daily-question&envId=2024-01-12
class Solution {
public:
    int countWords(vector<string>& words1, vector<string>& words2) {
        unordered_map<string,int> hash1,hash2;
        
        for(string& s:words1) ++hash1[s];
        for(string& s:words2) ++hash2[s];

        int ret = 0;
        for(string& s:words1)
            if(hash1[s]==1 && hash2.count(s) && hash2[s]==1) ++ret;

        return ret;
    }
};